import request from '@/utils/request'

export default {
  createOrder(data) {
    return request({
      url: '/orders',
      method: 'POST',
      data
    })
  },
  
  getOrders(params = {}) {
    return request({
      url: '/orders',
      method: 'GET',
      data: params
    })
  },
  
  getOrderDetail(id) {
    return request({
      url: `/orders/${id}`,
      method: 'GET'
    })
  },
  
  cancelOrder(id) {
    return request({
      url: `/orders/${id}/cancel`,
      method: 'PUT'
    })
  },
  
  confirmOrder(id) {
    return request({
      url: `/orders/${id}/confirm`,
      method: 'PUT'
    })
  },
  
  reorder(id) {
    return request({
      url: `/orders/${id}/reorder`,
      method: 'POST'
    })
  }
}